﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace VTFC
{
    // ----------------------------------------------------------------------------
    /// <summary>
    /// Logger class.
    /// </summary>
    // ----------------------------------------------------------------------------
    public class Logger
    {
        // ----------------------------------------------------------------------------
        /// <summary>
        /// Constructor.
        /// </summary>
        // ----------------------------------------------------------------------------
        static Logger()
        {
        }//ctor

        // ----------------------------------------------------------------------------
        /// <summary>
        /// Log an exception.
        /// </summary>
        /// <param name="ex">The <see cref="System.Exception"/></param>
        // ----------------------------------------------------------------------------
        public static void LogEvent( Exception ex )
        {
            LogEvent(EventLogEntryType.Error, ex.ToString());
        }//func LogEvent

        // ----------------------------------------------------------------------------
        /// <summary>
        /// Log an event.
        /// </summary>
        /// <param name="eventtype"><see cref="System.Diagnostics.EventLogEntryType"/> enum.</param>
        /// <param name="message">Event message.</param>
        // ----------------------------------------------------------------------------
        public static void LogEvent(EventLogEntryType eventtype, string message)
        {
            EventLog.WriteEntry(Constant.VTFC_APPLICATION_SMALL_NAME, message, eventtype);
        }//func LogEvent
    }//class Logger
}//namespace VTFC
